package com.njmaomao.gj.pyot.common.exception;


import com.njmaomao.gj.pyot.common.ResponseCode;

/**
 * 依赖的系统错误
 *
 * @author L440
 *         2017年4月26日
 */
public class ExternalSystemError extends RemoteCallException {

    private static final long serialVersionUID = 450681067074732794L;

    public ExternalSystemError(String code, String desc, String... format) {
        super(String.join(":", code, String.format(desc, format)));
    }

    public ExternalSystemError(String msg, Throwable cause) {
        super(msg, cause);
    }

    public static void happen(ResponseCode responseCode, String... format) {
        throw new ExternalSystemError(responseCode.getCode(), responseCode.getDesc(), format);
    }

}
